#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 1000

int result[N] = {0};

int VeryLongInteger[N] = {0};

void showa(int* a)
{
    int i = 0;
    int flag = 0;

    for(i = N-1; i >= 0; i--)
    {
        if(a[i] != 0)
        {
            flag = 1;
        }
        if(flag == 1)
        {
            printf("%d", a[i]);
        }
    }
    printf("\n");
}

void add()
{
    int i = 0, c = 0;
    int d = 0;

    for(i = 0; i < N; i++)
    {
        d = result[i] + VeryLongInteger[i] + c;
        c = d / 10;
        result[i] = d % 10;
    }
}

int main()
{
    //freopen("bin\\debug\\in.txt", "r", stdin);

    char str[N+1];
    int i = 0, k= 0;

    while(1)
    {
        scanf("%s", str);

        if(strcmp(str, "0") == 0)
        {
            showa(&result[0]);
            break;
        }
        k = 0;
        for(i = strlen(str)-1; i >= 0; i--)
        {
            VeryLongInteger[k++] = str[i] - '0';
        }
        for(; k < N; k++)
        {
            VeryLongInteger[k] = 0;
        }
        add();
    }

    return 0;
}
